@L|}6CD l0C)HCC WhL/h `CmCDiD`  R@W1  Y0@R !L` D  C D     )16CS S)  C)D1 p p 0 C9DI pCDL~CiCDiD`DEEP BLUE Cby John Howard Palevich INTRODUCTIONOVERVIEW The DEEP BLUE C COMPILER helps you create large progr}ams -- ones that take more than a day to write and can contain more than a hundred lines of code -- for your ATARI home compu}ter. It lets you write your programs in a subset of the popular programming language "C". C is a general purpose programm}ing language designed to fill the gap between BASIC and assembly language. Created by systems programmers as a high level al}ternative to assembly language, C is more powerful and faster than BASIC, yet clearer and less error-prone than assembly lang }uage. While slower running than assembly language, C code is much easier to write and understand. Pointers, recursive funct }ions, and high level control structures make complex software systems easy to design, implement and maintain. Furthermore, C } is the de facto systems programming language of the new generation of "workstation computers". Unlike programs written in a }ssembly language, you'll be able to transport your valuable C programs to other (especially non-6502-based) computers, with o }nly minor modifications. DEEP BLUE C is a proper subset of version 7 C, which mean that programs written for it will run a}lmost without change on computers supporting the full language. The DEEP BLUE C COMPILER is an extensively modified version }of Ron Cain's public domain Small-C Compiler. While the original Small-C Compiler was in the public domain this version is }protected by copyright.REQUIRED ACCESSORIES 48K RAM ATARI Disk Drive ATARI Program Text Editor (or other non-line}-oriented text editor)OPTIONAL ACCESSORIES ATARI Macro AssemblerSUPPORTED FEATURES DEEP BLUE C supports the followi}ng features: 1) char,int and pointer data types 2) single dimension arrays 3) Unary operators: +,-,*,&,++,--,!,$- }(tilde) 4) Binary operators:+,-,*,/,%,|,^,&,==,!=,<,<=,>=,<<,>>,=,&&,||,?:,comma 5) Statments:if,else,while,bre}ak,continue,return,for,do,switch,case,default 6) #define and #include compiler directives 7) Relocating linker 8) Co}nstants: hexadecimal, octal and backslashUNSUPPORTED FEATURES Features in C not supported in DEEP BLUE C are: 1) stru}ctures, unions 2) multidimension arrays 3) Floating point numbers 4) Functions returning anything but int 5) Unary op}erators: sizeof 6) Binary operators: typecastingDIFFERENCES FROM STANDARD C THE DEEP BLUE C language has the followin}g nonstandard features: 1. The last clause of a "switch" statement, either "case" or "default", must be terminated with a }"break", a "continue" or a "return" statement. 2. The ancient = construct has been removed. Use = instead. 3. C}haracters are unsigned. Chars range in value from 0 to 255. 4. Strings can not be continued on the next logical line. 5}. C source code lines can be a maximum of 79 characters long. 6. Functions can have a maximum of 126 arguments.SPECIAL S}YNTAX C uses several ASCII characters not available on the ATARI computer's keyboard. In particular the braces have been r}eplaced by to two-letter combinations $( and $), and the tilde has been replaced by $-. The $ character is not used in C, so} your editor's find and replace command can be used to convert standard c programs into a format acceptable to DEEP BLUE C.}CONSTANTS DEEP BLUE C supports the following types of constants: 1. decimal numbers like -12, 134, 4500 2. octal num }bers like 017, 045, 017777 3. hexadecimal numbers like 0xd400, 0xff, 0x2fc 4. character constants like 'a', 'ee', '0'!} 5. string constants like "foo", "bar blatz", "spam" You can embed in a DEEP BLUE C string any control or inverse video c"}haracter that can be embedded in a BASIC character string (like control-A thru control-Z or the directional arrow keys), with#} one exception. The control-comma (the heart) is used to signal the end of the string and thus shouldn't be used in a string$} constant. In addition, the backslash character (\) is used to generate certain useful characters: \f -- clear screen %} \g -- ring bell \h -- backspace \n -- EOL (new line) \r -- delete line \\ -- backslash \' -- apostrophe \" -- qu&}ote \t -- tab \###, where ### is a one-to-three digit octal constant which produces the ATASCII character with that AT'}ASCII code.RELATED PUBLICATIONS This manual won't teach you C. If you don't know C, you should obtain a copy of THE C P(}ROGRAMMING LANGUAGE, by Brian W. Kernighan and Dennis M. Richie, 1978, Bell Telephone Laboratories, Inc., which is published )}by Prentice-Hall, Inc., Englewood Cliffs, NJ 07632. Many of the examples in the book use the UNIX I/O functions, which are s*}lightly different from the ones supplied with DEEP BLUE C.GETTING STARTEDDUPLICATE THE DISKETTE You should first make +}working copies of your DEEP BLUE C diskette, and store the original. Files on your diskette are as follows: 1. DOS.SYS --,} standard DOS-II FMS file 2. DUP.SYS -- standard DOS-II DUP file 3. CC.COM -- Deep Blue C Compiler 4. CLINK.COM -- D-}eep Blue C Linker 5. DBC.OBJ -- C Run-time Module 6. AIO.C -- source for I/O functions 7. AIO.CCC -- object for AIO.}.C 8. GRAPHICS.C -- source for graphic and game I/O 9. GRAPHICS.CCC -- object for GRAPHICS.C 10. PMG.C -- source for /}player/missile and character set graphics 11. PMG.CCC -- object for PMG.C 12. PRINTF.C -- source for formatted output 10}3. PRINTF.CCC -- object for PRINTF.C 14. X.C -- source for demo program 15. X.CCC -- object for X.C 16. X.LNK -- link f1}ile for X.C 17. X.COM -- executable version of X.C 18. BOUNCE.* -- source, etc., for graphics demo 19. MEDITC.ECF -- PR2}OGRAM/TEXT EDITOR ".C" customization fileUSING DEEP BLUE CINTRODUCTION Four steps are necessary to turn a C program on3} paper into an executable machine language file on the ATARI computer: 1. You enter the program as one or more source file4}s, using a text editor. 2. You compile the source files into object files by the Deep Blue C Compiler. 3. You create a 5}link file. The link file contains the names of all the object files that are part of the program, and is used by the linker 6}(in step 4) to gather together all the parts of the program. 4. Using the Deep Blue C Linker, you link together into an ex7}ecutable file the individual object files that make up the whole program.FILE EXTENSIONS Each kind of file has its own e8}xtension. The extensions used by DEEP BLUE C are as follows: Source file -- .C Object file -- .CCC Link file -- .LNK 9} Executable file -- .COMEDITING A C SOURCE FILE DEEP BLUE C source files contains the text representation of a C program:}, the comments associated with that program, and the compiler directives needed to compile the program. C is a modern high-l;}evel language best edited with a screen-oriented text editor. The ATARI Program Text Editor, available through the ATARI Pr<}ogram Exchange (also included in the ATARI Macro Assembler), is excellent for editing C ditor, available through the ATARI PrXprograms. The editor's file MEDIT.ECF contains the appropriate tab settings for editing C text. If you have another text >}editor, you can also use it to edit your C programs. The only requirement is that your editor must not insert line numbers a?}t the beginning of each line. Thus you can't use the ATARI BASIC or Assembler Editor editors to edit your C text, unless you@} write a utility program to remove the line numbers before compilation. All C files should have the extension ".C", as in A}AIO.C, PRINTF.C and X.C . The ".C" extension is traditional, and is also is the default extension assumed by the compiler.B} C source may contain all ATASCII characters. The two formattings characters TAB (decimal 127) and EOL (decimal 155) are trC}eated as if they were spaces, which means you can use them to indent the C text to make it more readable.COMPILING, LINKINGD} AND EXECUTING A C PROGRAMTHE COMPILER Once entered, the C program must be translated into a special code (called objectE} code) before it can be executed. The program that does this translation is called the Deep Blue C Compiler. The compiler rF}eads a program from a C file, translates it into object code, and then writes the object code into a file with the extension G}.CCC . For example, to compile the program X.C you would do the following: 1. Remove all cartridges from your ATARI compuH}ter. 2. Turn on the disk drive and insert the Deep Blue C diskette. 3. Turn on your computer and TV set. 4. When theI} DOS-II menu displays, type L (for Load File), press the RETURN key, type CC.COM and press RETURN again. 5. Once the Deep J}Blue C Compiler loads into computer memory, it clears the screen and prints its header message: Deep Blue C Compiler versiK}on 1.1 (C)1982 John Howard Palevich File to compile (or RETURN to exit)Figure 1. Deep Blue C Compiler Display 6. iL}nsert the diskette containing the source text file and type in the name of the C text file you want to compile. Where the fuM}ll name is in the form D:X.C, you need type only the main part of the file name -- X in this case -- and the rest of the nameN} will default to the D: disk drive and the .C file. Thus, you would type X and press the RETURN key. 7. The compiler prinO}ts D:X.C->D:X.CCCwhich mean that the input file D:X.C is being read in, translated to object code, and written out P}to a file called D:X.CCC . In general, the name Dn:.C will be translated into the file Dn:.CCC . 8. The compilQ}ation may take several minutes, depending on the length and complexity of the source program. To give you an idea of what itR} is doing, the compiler prints the name of the current function it's parsing. 9. If you have any syntax errors, the compilS}er prints the line where it detected the error, an arrow pointing to the point in the line where it detected the error, and tT}he line of text discribing the error An example is: main()$(printf("Hello, World/n"); Missing final end Figure 2. CU}ompiler error message. 10. If you have no syntax errors, the compiler prints the reassuring message "No errors.". In eithV}er case, you are again prompted File to Compile (or RETURN to exit) If you have more than one file to compile at a timW}e, you can type the next file name now, followed by RETURN. 11. When the compiler has finished compiling your files, pressX} RETURN to go back to the DOS-II menu.LINKING A C PROGRAM Once you have compiled without error, the individual files makY}ing up the c program, you must link the whole program into an executable file. To link together a C program, you construct tZ}he text file, called a "link" file, that contains the names of all the files to be linked to produce the complete program. [} A typical small program, such as X.C, needs two files in addition to itself: AIO.CCC (the compiled C code of the I/O functio\}ns) and the DBC.OBJ (the run-time package). If you were to print out the file X.LNK, you would see that it contains the foll]}owing text: X AIO DBC.OBJ Figure 3. Contents of X.LNK file The files must have the Dn: prefix if they ar^}e other than drive 1. If no extension is given, a "CCC" extension is assumed. The LNK file can't contain any blank lines, n_}ot even at the end of the file. Two types of files make up an executable C program: .CCC files, produced by the compiler, `}and .OBJ files, produced by the ATARI Macro Assembler (or other assembler), which cotain machine language. ".CCC" files are la}inked together in a C program, while .OBJ files are copied verbatim into the output file. All C programs must include the b}file name DBC.OBJ in their link file. DBC.OBJ contains the run-time routines and the C-code interpreter needed to execute prc}operly. If you see the "asm" keyword (discribed later) then you want to have your own machine language file loaded automaticad}lly, then you would list it to the link file, too. Once you've written the link file for your program, you can link it by e}running the DEEP BLUE C Linker. Put the DEEP BLUE C diskette into the disk drive, close the door, boot DOS-II, and type L [Rf}ETURN], and then CLINK.COM [RETURN]. The DEEP BLUE C Linker will load into memory and display its message: Deep Blue Cg} Linker version 1.1 (C)1982 John Howard Palevich Link program, Duplicate file or Quit Figure 4. Deep Blue C Linker h}display Type the first letter (L,D, or Q) of a command, followed by pressing the RETURN key. Link constructs a working C i}program out of its parts. Duplicate lets you move small files from one diskette to another without having to use DOS-II's O j}command. Quit returns you to DOS-II.Duplicating a file You can now use this command to copy .CCC files from the diskettk}e where the were compiled onto the diskettes on which they are to be linked. Except for the limited file size (about five thl}ousand characters), this command acts like the O command in DOS-II. To duplicate a file, type the letter D, then a space, m}and then the name of the file you want to duplicate. The linker prompts you to insert the source diskette, after which you sn}hould press RETURN. The linker reads in the file, and then prompts you to insert the destination diskette, after which you so}hould press RETURN. The linker then writes a duplicate copy of the file onto the destination diskette.Linking a file Onp}ce you've compiled all the files making up your C program, you must link them together using the L command of the linker. Toq} link the separate parts of your program together, type L, space, link file name, and then press RETURN. For example, Lr} X [RETURN]instructs the linker to link together the program X.COM according to the directions in x.LNK. The linker wills} fail to link if the files you specify don't exist. In addition, if it can't find a function or external variable declaratiot}n, it will complain "undefined label: ", and list the missing variable's name. If you mistyped a variable name (such as "alhu}pa" instead of "alpha" fined label: ", and list the missing variable's name. If you mistyped a variable name (such as "alh), the misspelling will show up here. If there are no errors, the linker prints "No errors" before redisplaying the "Link,w}Duplicate, or Quit" prompt.Exiting the linker When you've finished duplicating files and linking programs, you can exit x}the linker by typing Q [RETURN].RUNNING A C PROGRAM A compiled and linked C program can be treated like any other executy}able file. You can even rename it AUTORUN.SYS to have it load into memory automatically when you turn on the disk drive and z}the computer. Like other object code files, it should be loaded with the L command on the DOS II menu.Run-time errors O{}nly 4 errors can occur at run time (that is, while the C program is executing). Of these, only the first is common. Should |}any of them occur, your program stops and the following message displays on the screen: dbc 1 run-time-error }} type a key to return to DOS. Figure 5. Run-time Error message The will be one of the following: A -~} stack overflowed RAMTOP -- either you are recursing endlessly, or you have defined too many variables. B - Illegal op-c}ode -- your program has messed up its code area, and tried to execute garbage. C - version error -- you have versions of} CC.COM, CLINK.COM, and DBC.OBJ that don't have the same version number. D - divide by zero -- you've tried to divide a }number (or take its remainder) by zero.EXECUTING THE DEMONSTRATION PROGRAMS Included on your Deep Blue C diskette are tw}o useful demonstration programs to help you get aquainted with DEEP BLUE C. The source, compiled object, link, and executabl}e object files are included for each program. The first program, X, demonstrates some of the I/O capabilities of DEEP BLUE} C. It includes options for reading and writing files. To execute X, first load in DOS, and then type L (for Load File), pr}ess the RETURN key, type X.COM, and press RETURN again. Once X loads into memory, it prints the following message: }File reader/writer Command: r,w,q -> Figure 6. X Display Screen You may read a file by typing "r", write o}ne by typing "w", or exit the program by typing "q". A useful exercise might be to read the file X.C, which illustrates the }use of open, cclose, gets, getchar, and printf functions. The second demonstration, illustrates the use of player/missle g}raphics. It includes examples of the functions color, plot, drawto, sound, pmcinit, plmove, and pmcolor among others. It ca}n be executed like X by selecting the file BOUNCE.COM instead of X.COM. Once again, the useful exercise might be to examine }the source contained in the file BOUNCE.C.THE DEEP BLUE C LIBRARYINTRODUCTION Unlike most other languages, C has no bu}ilt-in I/O statements. Instead of BASIC's PRINT or Pascal's WRITE statements, C uses functions for its I/O. While extremely} useful, this aspect of C means that each C has its own version of the basic input/output functions. Deep Blue C is, alas, n}o exception, but if you find its mix of predefined functions lacking in one way or another, you are welcome to define new I/O} functions to fit your needs! The functions defined in the files AIO.C, GRAPHICS.C, PMG.C, and PRINTF.C, give you access t}o the ATARI Computer's hardware at about the same level as BASIC does. C library functions with familiar names (like plot(),} drawto(), and poke() act, on the whole, like their BASIC counterparts. While the most accurate definition of each function }is its C code, her is a description of each function.FUNCTIONS DEFINED IN AIO.Cclear(s,len)char *s;int len; clear90 }puts zero bytes in s[0..len-1], which makes it useful for initializing large arrays. For initializing integer arrays, the le}ngth argument should be multiplied by two, so that the length is in bytes rather than in words.copen(fn,mode)char *fn,mode}) The copen function opens the file named in the string 'fn' for reading, writing, or appending, depending upon the value }of the character 'mode': 'r' -- read file (like OPEN #n,4,fn$) 'w' -- write file (like OPEN #n,8,0,fn$) 'a'} -- append file (like #n,12,0,fn$) If the file is opened successfully, the IOCB number used by that file (0 to 7) is retu}rned as the value of the function. You must save this value in a variable to be able to use the file. If the file doesn't} open successfully, the function will return a negative number, where the number is the negative of the CIO error code. For }example, if you pressed the BREAK key while copen was trying to open a file, then copen would return a -128.open(iocb,ax1,a}x2,fname)char iocb,ax1,ax2,*fname This is the familiar OPEN statement from BASIC, open() returns 1 if there was no proble}m; otherwise, it returns the negative of the CIO error code.close(i)char i; This is the familiar CLOSE from the BASIC. }It closes the IOCB and returns 1 or the negative of the CIO error code.cclose(i)int i; When you want to close a particu}lar file, you should call cclose() with the number returned by copen(). cclose() will return either a 1 (if everything turne}d out OK), or a negative number (the negative of the CIO error code) if the file failed to close.cgetc(iocb)int iocb; c}getc() is very much like the BASIC GET statment. You pass the iocb number and it returns either the next character in the fil}e (which will be between 0 and 255) or a negative number that's the CIO error code.cputc(c,iocb)char c;int iocb; cputc}() is very much like the BASIC PUT statement. You give it the character you wish to print and the iocb number, and it prints }that character into that file. If there is no error, cputc() returns 1; otherwise, it returns the negative of the CIO error }code.getchar() getchar() gets one character from the screen (iocb 0) and returns it to you (or the negative of the CIO e}rror code).putchar(c)char c; putchar() prints the character you give it onto the screen (iocb 0), and returns 1 or the }negative of the CIO error code.gets(string)char *string; gets() is like the BASIC INPUT statement. It gets an entire lo}gical line of text from the user and places that line in the character array you give as an argument. Make sure your charact}er array is at least 120 characters long; otherwise the user could overflow your array by typing in a very long line. If ther} are no errors, gets() returns the number of characters in the line of input (0 to 120). If there is an error, gets() returns} the negative of the CIO error code.cprint(string)char *string; cprint() is like the BASIC Print statement. It prints t}he string you give it out onto the screen. It will not print a RETURN, but you can use the statement "putchar(155);" to caus}e a carriage return.cputs(string,iocb)char *string;int iocb; cputs() is like the BASIC PRINT# statement. It prints th}e string you give it out to the file you specify. You should use the iocb number that copen() returned. If there are no h|errors, cputs() returns a 1; otherwise, it returns the negative of the CIO error code.ciov(iocb,com,bad,blen,ax1,ax2)int i }ocb,com,blen,ax1,ax2;char *bad; ciov() is like the BASIC XIO call. You can set up the iocb of your choice, and then call } the CIO via this function. The argument iocb should be between 0 and 7, and it should specify which I/O control block you'r }e using. Com is the ICCOM command code, bad is the ICBAD buffer address, blen is the ICBLEN buffer length, ax1 is the ICAX1 }auxiliary byte, and ax2 is the ICAX2 auxiliary byte. If you don't want to change the current value of any of the last four a }rguments (buf,blen,ax1, or ax2), use the value -1. Thus, to read another line into the current buffer, you would use: }ciov(1,5,-1,-1,-1,-1); Most of the I/O functions are implemented using calls to ciov(). The two exeptions, cgetc() and cp }utc(), are coded in assembly language to speed them up slightly. If the CIO returns a result less than 128, ciov() returns i }t as it is, but if the CIO result code is greater than or equal to 128 (which means that an error has occurred),ciov() return }s the negative of that code. This approach is in keeping with "standard usage" in C, which has error codes less than zero. }normalize(fname,fext)char *fname,*fext; normalize() is a handy utility function used to convert free-form file names into } CIO and FMS standard file names. First the file name is converted into upper case, and then, if there is no device prefix, }D: is added to the front of the name. If there is no extension, a period and the extension in the string text is appened on }to the file name. A typical use, "char fname[20]; gets (fname); normalize(fname,"BAS"), would ensure that the file name in f }name is acceptable to the CIO system. For example, if the user had input "prog", after normalize(fname,"BAS), the string woul }d contain "D:PROG.BAS".toupper(c)char c; If c is lower case, toupper() returns the uppercase equivalent, or else toupp }er() returns c.tolower(c)char c; If c is upper case, tolower() returns the lowercase equivalent, or else returns c.st }rcpy(a,b)char *a,*b; strcpy() copies a string from character array b to character arry a. strcpy returns the length of t }he string it copied, not counting the trailing zero byte.move(a,b,len)char *a,*b;int len; move() moves len bytes from }a to b, starting with the byte at a[0] and finishing with the byte at a[len-1]. Funny things will happen if a<=b<=a+len.us }r(addr,. . . .)int addr; usr() is like the BASIC USR(x) function. The first argument is the address of the machine langu }age subroutine, and the rest of the arguments are passed on to that subroutine. The result is passed in the A(low) and X(hig }h) registers. When the user's routine is called, the stack looks (in the order items would be PLA'd off the stack) like this: } zero page va }riables $F6 to $FF are free for use with usr() subroutines find(addr,len,ch) char *addr,ch;int len; find() searches meno }ry from addr to addr+len-1 for the first occurrence of ch. IF it doesn't find ch, it returns -1; otherwise, it returns the nu }mber of characters past addr that it found ch (range of 0 to len-1).peek(i)char *i,d; peek() returns the byte at memory } address i.poke(i,d)char *1,d; poke() pokes byte d into address i, and then returns the OLD byte at i.dpeek(i)char * }i; dpeek() returns the word at i (least signifigant byte) to i+1 (most signifigant byte).dpoke(i,w)char *i;int w; d }poke() pokes the word w into address i 10 i+1, and then returns the old word at that address.val(s)char *s; val(), like } BASIC's VAL function, takes a string as input and returns its numeric value.hval(s)char *s; hval() takes a string as i }nput and returns its hexadecimal value.FUNCTIONS DEFINED IN GRAPHICS.Cgraphics(n)char n; graphics() changes the scr }een's graphics mode, just like the BASIC GRAPHICS statement. It returns the same status as open().color(c)char c; colo }r() sets the color to plot() or drawto(), just like the BASIC COLOR statement. It returns garbage.srawto(x,y)int x,y; }drawto() draws a line from the last plotted point to (x,y), just like BASIC's DRAWTO. It returns 1 if there are no errors; o }therwise, it returns the CIO error code.locate(x,y)int x,y; locate() locates the graphics cursor at the position (x,y) }and returns the value of that pixel, or the CIO error code. It's exactly like BASIC's LOCATE statement.plot(x,y)int x,y; } plot() plots a point at (x,y) just like BASIC's PLOT statement. It returns 1 if there are no errors; otherwise it returns }the CIO error code.position(x,y)int x,y; position() positions the graphics cursor at new (x,y). The cursor isn't actua }lly moved until the next output.setcolor(reg,hue,lum)char reg,hue,lum; setcolor() sets the color # reg to the color com }bination hue,lum. It's just like the BASIC SETCOLOR statement.fill(x,y,c)int x,y;char c; Fill implements the FILL com }mand of the S: device. It draws a line from the last point plotted to (x,y), filling the background to the right of the line }with the color provided. This is somewhat useful for filling in large trapezoidal regions of the screen with color. See pag }e 54 of the ATARI BASIC Reference Manual for more details.paddle(n)char n; paddle() returns the value of the numbered p }addle, just like BASIC's PADDLE function.ptrig(n)char n; ptrig() returns the value of the numbered paddle trigger, just } like BASIC's PTRIG function.stick(n)char n; stick() returns the value of the numbered joystick, just like BASIC'S STIC }K function.strig(n)char n; strig() returns the value of the numbered joystick's trigger button, just like BASIC's STRIG } function.vstick(n)char n; vstick() returns the vertical component of the joystick n. If the joystick is pointed forwa }rd (up), vstick() returns 1. If it's pointed back (down), vstick() returns -1. If it's centered (vertically), vstick() retu }rnd 0.hstick(n)char n; hstick() returns the horizontal component of the joystick n. If the joystick is pointed left, hs }tick() returns -1. If it's pointed right, hstick() returns 1. If it's centered (horizontally), hstick() returns 0.sound(v }oice,pitch,dist,volume)char voice,pitch,dist,volume; sound() makes sound effects just like BASIC's SOUND statement.rnd( }n)int n; rnd() returns a random number between 0 and n-1 (inclusive). Therefore, to generate a random number between 1 a }nd 10, you would use the expression: 1+rnd(10). If n is less than 2, then rnd() will return 0.FUNCTIONS DEFINED IN PMG.C }pmcinit() pmcinit() initializes player/missile and character set graphics. pmcinit may be called only once, and should be } used BEFORE any callsnitializes player/missile and character set graphics. pmcinit may be called only once, and should be to graphics().pmcflush() pmcflush flushes player/missile and character set graphics buffers out of ram, returning the 4k} of RAM that they use. pmcflush() should be called only once, just before returning to DOS.pmgraphics(i)int i; pmgraph}ics() should be called AFTER each call to graphics() to set up the resolution of the player/missile graphics. pmgraphics(1) }produces single-line resolution, pmgraphics(2) produces double-line resolution and pmgraphics(0) inhibits player/missile grap}hics altogether.hitclear() hitclear() clears the collision registers.hitp2pf(from,to)char from,to; hitp2pf() retur}ns 1 if player # "from" hit playfield # "to"; otherwise, it returns 0.hitp2p1(from,to)char from,to; hitp2p1() returns 1} if player "from" hits player "to". Returns 0 if player "from" did not hit player "to". If "from" is equal to "to" then 1 i}s returned.pmclear(n)char n; pmclear() clears player number "n".pmcolor(n,c,i)char n,c,i; pmcolor() sets the colo}r of player/missile "n" to hue "c" and intensity "i".pmwidth(n,w)char n,w; pmwidth sets the width of player "n" to "w":} w == 0 means normal size w == 1 means twice normal w == 3 means four times normalpladdr(n)char n; pladd}r() returns the address of the buffer containing player "n". plmove() moves player "n" to position "x","y" (in the current} pmgraphics() mode's coordinates) and draws its shape from the character array "shape". shape[0] is the size of the player's} shape, and shape[1..size] is the byte pattern for the player itself. Be sure to put several zero bytes before and after the} actual graphic so that previous images will be erased properly.chget(c,s)char c,*s; chget() fills the s[0..7] with the} character font for the ATARI internal character whose code is c. ATASCII blank-space's internal representation is 0, so its }current font could b3 obtained by chget(0,s).choget(c,s)char c,*s; choget() fills s[0..7] with the ORIGINAL (ROM) chara}cter font for internal character code c.chput(c,s)char c,*s; chput() makes the contents of s[0..7] the font for interna}l character code c. To put a dot in tie middle of the space, one would say chput(0,"\0\0\0\60\60\0\0\0"); REMEMBER, you m}ust use pmcinit() before any other function in PMG.C will work.FUNCTIONS IN PRINTF In addition to the functions in AIO, }there are two MOre library functions in PRINTF.printf(s, ... )char *s; printf() is the standard C formatted output func}tion. It takes a variable number of arguments. The first one is a formatting string containing the message to be printed, a}long with characters specifying where to insert the rest of the arguments. The % character is special when it appears in t}he format string. The characters following the % tell how to print one of the arguments. The first % matches the first argu}ment after the format string, the second % matches the second argument and so on. If you specify too few arguments (or too m}any %'s), your output string will be garbled. After a % you may type one of the following letters: d -- to print a de}cimal number. x -- to print a hexadecimal number. c -- to print a character. s -- to print a string. % -- to }print a %. If you want the argument to take at least a certain number of characters, type a number between the % and the f}ormat character. The velue will be right-justified. If you want it left-justified, then insert a minus sign before the numb}er. Here are some examples:printf("abcd"); produces abcdprintf("=%s=","abcd"); produces =abcd=printf("=5d=",99); produc}es = 99=printf("=-5d=",99);produces =99 =printf("%c %d %x",65,65,65); produces A 65 41fprintf(iocb,s, ... )int iocb};char *s; fprintf() is just like printf() except that it takes an additional argument, iocb, and outputs to that iocb. p}rintf( ... ) is essentially fprintf(0, ... ). TECHNICAL NOTESADDING MACHINE-LANGUAGE FUNCTIONS TO DEEP BLUE C } If you look at the AIO.C file, you'll note that the "primative" functions, like ciov(), are defined in a pecular way, using }the asm statement: ciov(iocb,com,bad,blen,ax1,ax2) int iocb,com,blen,ax1,ax2; char *bad; asm 12291;This kind of fu }nction definition, using asm rather than $($), creates a "hook" into machine language. When an "asm" function is  }called, the arguments are pushed onto the machine stack just like the BASIC USR() function, and then a jump is made to the ad }dress that follows the "asm" keyword. If you want to add a hook into your machine language program starting at memory locati }on $600, you would simply write: foo() asm 0x600; In addition, you've got to put your machine language into a binary  }file (which must have the extension .OBJ) and include the file name in your link file. Note that you can use any assembler t}hat can produce object files. Don't forget that the number of arguments you actually get may vary, depending upon how many} the user supplies. You should use the byte on the top of the stack to tell you how many arguments to pop off the stack befo}re returning.RAM USAGE The DEEP BLUE C run-time package uses ram from $3000 to $3FFF, and the user's program starts at $}4000 and continues towards the top of memory. You can use page six and any ram free between the top of the OS and $3000 for }your own purposes. Although the compiler needs 48k of RAM, most DEEP BLUE C programs will run in much less space. It's cert}ainly possible to create useful programs that run in as little as 24k of RAM.ograms will run in much less space. It's certO D  C D     )16CS S)  C)D1 p p }0 C9DI pCDL~CiCDiD` DD˙` d J)L !}D L(( LL()  L| L( S LH 0p n  } CY?  q  L L  ` )} `A! d߰")-݆ "  $G@LLL&0") $G%}H0 3S8`G ȱG ȱG   Gȭ Gȭ GG}GHiH8(()) G$H% `(0})8` d)L ݆ & LGȘ ݆LL d  ! LL d)N>Q  HH)}  hyhyB q L> Lm JJ  Ln*` dB%'}8  H H` 1 { LL   !L     Hh SY?  q  1L}  !? S   q 1 L   Ll  Lg E`L   !L)  q 1L}) `L0AM݊L݉ ML  N݆LLLNLMLHG!@}1F GȱGLLEEȩÑEȑEEȑE Ed E7EȩE  q } L !,0,0SGɛ L 1 !L EHEh W G gLLSROTCES EERF !} G) *Gȩ GȽG GȌd q q G`  8   0G  `D"}CEDC0X:Ȣ Y ȱC* ? 0.. , 0%n ?A[ 0 : L`L  `, 0`Y#}`piH n0)բY? 08`0 $}  0$L GGȽG L `8L`L%}8`  05G)݁,G)ȱGȱGHh0})Hh` B! 8`8iiiLE`&}E8FEh( l0`ɃLL L8^~jj8jHi hEEEiEȱEiE` dTE'} H8EEȱEEȩEh J E8   . m  i`LI!)E1FR(}1LJ舩9GIH`LJJ`HGHh l`)} S gL   8 rii `дCDCG W  *}C  Lq` X٨`DOS SYS IIIIIIIIIIIIIIIC`0 ߩ0}}PP+}D |||DDOS DOSDOS SYS },}},-}B9DOC 000B9=DOC 001B8vDOC 002B9DOC 003B-DOC 004CDOS SYS.} 0`BDELV !B /}`LVUQ   ]   TU J ]L!T  #      TU 0} L ? .  t`GBJ V~DEHI B V0dV1}QDEHI VF9 ,0 ,0 s0hhL  L` H hDHEh2}DEL8HI   0 HI,0 0  9 .G VLO3},0 L4*IJ`llD1:AUTORUN.SYSNEED MEM.SAV TO LOAD THIS FILE.D1:MEM.SAV J y08 B|DEHI4} V0 0`B;DELV䌚 !B y`@ʆ v s? F0Ξ05: [ BDEHI5} VY8 B V  @  /DE `E:D1:DUP.SYSERROR-SAVING USER MEMORY ON DISKTYPE Y TO 6}STILL RUN DOS B;DE J V (` 9 V⪍ ઍ  -7}LLu DEHILV 9 .l 9 .l  `` s$B VBH8}I|DE V BLV nB,DE J V* \*` B V BLVDEHI BLVL9}1u H232435; 1 ;  hh@2 e1i1LHҍ 00) 08 109hh@ Ҡ2e:}1i1232435ޥ<<8} 3E:}DISK OPERATING SYSTEM II VERSION 2.0SCOPYRIGHT 1980 ATARIA. DISK DIRECTORY I. FORMAT DISKB. RUN CARTRIDGE J. D<}UPLICATE DISKC. COPY FILE K. BINARY SAVED. DELETE FILE(S) L. BINARY LOADE. RENAME FILE M. RUN AT ADDRESSF. LOCK F=}ILE N. CREATE MEM.SAVG. UNLOCK FILE O. DUPLICATE FILEH. WRITE DOS FILES9!&x#!7&p))'&X*./)L''-؆莟>}R'S  vW DEHHI 1A#! @ ~0ɛ8A0.) ȅ 1 1i?}il ! 1L NO SUCH ITEMSELECT ITEM OR FOR MENU! 0 .{z:*{}.|~ 1 0 0@}JB 18L^%|DLl%DIRECTORY--SEARCH SPEC,LIST FILE? # 0 0 n&|D! 1L NOT A DISK FILEA}N !B 1L " 1 !BDED:}:1BJ|DE 1DEBHB}I 1 h0ߢ 0.  0?詛 1 ~0YЛ 1 "L<" "L C} BL1TYPE "Y" TO DELETE...DELETE FILE SPECCOPY--FROM, TO?OPTION NOT ALLOWED067 FREE SECTORS COPYING---D1:DASHD}LOAD.SND# 0|D .L$A#B#C#JB|DE 1BHIDD#E 1D#0: BE} 1L B#C#C#B# B 1N#$0SYS1}:e#D# d# D# .d#ȽD# d# 𩛙d#X# 1,A#F}PdD#ELO- A.BJdD#E 1 1HH 0hh|DL^%1}:e# Lt% e#dD#EL%G} 1 0 . .0% 1L WILD CARDS NOT ALLOWED IN DESTINATION 0 A.|K@C6xo~{>>888>|||f<!}c6>8pp8?!}w><~~~<||`x`~<~~>``f||f88<<w!}wk~~fff~~ff~~~f~``~~f~~~```~`~~~~fff~~ff~<ckwf~<~fff~~~~~0~<~~<!}~x|ngTTTTTTfff~~`~~fl0fF>6xo~{>>888>|||f<